 /**
 * Description: 客服问题记录
 * @author:jacky
 * @since:1.0.0
 *
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2018-05-08   jacky       1.0.0     Initial
 */
package com.metro.demo.cust.service.impl;

import com.metro.core.dao.IMapper;
import com.metro.core.service.BaseServiceSupport;
import com.metro.core.service.ServiceException;
import com.metro.core.vo.ResultCode;
import com.metro.core.vo.inf.IResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.metro.demo.cust.mapper.IBizCustomerManageMapper;
import com.metro.demo.cust.service.inf.IBizCustomerManageService;
import com.metro.demo.cust.beans.vo.BizCustomerManage;

 /**
 * 客服问题记录<br>
 *
 * @author:jacky
 * @since:1.0.0
 * @version [1.0.0, 2018-05-08]
 */
@Service("bizcustomermanageService")
public class BizCustomerManageService extends BaseServiceSupport<BizCustomerManage> implements IBizCustomerManageService{
    //客服问题记录Mapper
    @Autowired
    private IBizCustomerManageMapper bizcustomermanageMapper;

    @Override
    public IMapper getMapper() {
        return bizcustomermanageMapper;
    }

    @Override
    public IResult save(BizCustomerManage entity) {
        try {
            bizcustomermanageMapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增客服问题记录失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(BizCustomerManage entity) {
        try {
            bizcustomermanageMapper.update(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改客服问题记录失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
            bizcustomermanageMapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
            bizcustomermanageMapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }
    /**
     * 修改非空
     */
    @Override
    public void updateAttachment(BizCustomerManage entity) {
        try {
            bizcustomermanageMapper.updateNotEmpty(entity);
        } catch (Exception e) {
            log.error("修改客服问题记录失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }
}